<h2>{translate text='Place a Request'}</h2>

{if $results.sysmessage}
<p class="error">{translate text=$results.sysmessage}</p>
{/if}

  <div class="hold-form">

  <form action="{$url|escape}/Record/{$id|escape}/Hold{$formURL|escape}" method="post">
    
    {if in_array("comment", $form_fields)}
    <div>
    <strong>{translate text="Comments"}:</strong><br>
    <textarea name="gatheredDetails[comment]">{$gatheredDetails.comment|escape}</textarea>
    </div>
    {/if}
   
    {if in_array("required_by", $form_fields)}
    <div>
    <strong>{translate text="Required By"}: ({translate text=hold_date_format})</strong><br />
    <input id="datePicker" type="text" name="gatheredDetails[required_by]" size="10" value="{if $gatheredDetails.required_by !=""}{$gatheredDetails.required_by|escape}{else}{$defaultduedate}{/if}"><br />
    </div>
    {/if}
    
    {if in_array("pickuplib", $form_fields)}
    <div>
    {if count($pickup) > 1}
    {$primary_library}
    <strong>{translate text="pick_up_location"}:</strong><br>
    <select name="gatheredDetails[pickuplib]">
    {foreach from=$pickup.$home_ILS item=lib name=loop}
      {if $lib.libid == $gatheredDetails.pickuplib}{assign var='selected' value=$lib.libid}{elseif $lib.libid == $home_library}{assign var='selected' value=$lib.libid}{else}{assign var='selected' value=''}{/if}>
      {$selected}
      <option value="{$lib.libid|escape}" {if $selected == $lib.libid}selected="selected"{/if}>{$lib.libname|escape}</option>
    {/foreach}
    </select>

    {else}
      <input type="hidden" name="gatheredDetails[pickuplib]" value="{$pickup.0.libid|escape}" />
    {/if}
    </div>  
    {/if}
    
    <input type="hidden" name="gatheredDetails[id]" value="{$id|escape}" />
    <input type="hidden" name="gatheredDetails[system]" value="{$gatheredDetails.system|escape}" />
    
    {if in_array("sys_id", $form_fields)}
    <input type="hidden" name="gatheredDetails[sys_id]" value="{$gatheredDetails.sys_id|escape}" />
    {/if}
    
    {if in_array("item_id", $form_fields)}
    <input type="hidden" name="gatheredDetails[item_id]" value="{$gatheredDetails.item_id|escape}" />
    {/if}
    
    {if in_array("holdtype", $form_fields)}
    <input type="hidden" name="gatheredDetails[holdtype]" value="{$gatheredDetails.holdtype|escape}" />
    {/if}
    
    {if in_array("format_id", $form_fields)}
    <input type="hidden" name="gatheredDetails[format_id]" value="{$gatheredDetails.format_id|escape}" />
    {/if}
    
    <input type="submit" name="placeHold" value="{translate text="Place Hold"}">
  </form>
  
  </div>
